// 把所有用户操作的功能，全写在这里
import axios from '@/utils/request'

// 登录
export function login (data) {
  return axios({
    method: 'post',
    url: '/user/login',
    data
  })
}

/**
 * 退出登录
 * @param {*} data
 * @returns
 */
export function logout (data) {
  return axios({
    method: 'POST',
    url: '/user/logout',
    data
  })
}

// 注册
export function register (data) {
  return axios({
    method: 'post',
    url: '/user/register',
    data
  })
}
// 获取省
export function provinceList (params) {
  return axios({
    method: 'get',
    url: '/province/provinceList',
    params
  })
}
// 获取市
export function getCityByProvice (params) {
  return axios({
    method: 'get',
    url: '/province/getCityByProvice',
    params
  })
}
// 获取医院
export function getHospitalByCity (params) {
  return axios({
    method: 'get',
    url: '/province/getHospitalByCity',
    params
  })
}
// 获取科室
export function getDepartByHospital (params) {
  return axios({
    method: 'get',
    url: '/province/getDepartByHospital',
    params
  })
}
// 获取职称
export function professionalList (params) {
  return axios({
    method: 'get',
    url: '/province/professionalList',
    params
  })
}
// 修改手机号
export function changemobile (params) {
  return axios({
    method: 'get',
    url: '/user/changemobile',
    params
  })
}
// 修改密码
export function changepwd (params) {
  return axios({
    method: 'get',
    url: '/user/changepwd',
    params
  })
}
/**
 * 手机验证码登录
 * @param {*} mobile
 * @param {*} captcha
 * @returns
 */
export function mobileLogin (data) {
  return axios({
    method: 'POST',
    url: '/user/mobilelogin',
    data
  })
}
/**
 * 发送验证码
 * @param {*} mobile
 * @param {*} event 登录：mobilelogin   注册：register 修改手机号：changemobile
 * @returns
 */
export function sendMobileCode (data) {
  return axios({
    method: 'POST',
    url: '/sms/send',
    data
  })
}
